/**
  ******************************************************************************
  * @file    bsp_uart_ex.h
  * @author  Iron
  * @date    2022-01-27
  * @version v1.0
  * @brief   bsp_uart_ex header file
  */

#ifndef __BSP_UART_EX_H
#define __BSP_UART_EX_H

#ifdef __cplusplus
extern "C" {
#endif

/* Exported includes ---------------------------------------------------------*/
#include "bsp_uart.h"

/* Exported define -----------------------------------------------------------*/
#define BSP_UART_BUSY               (-3)
#define BSP_UART_TIMEOUT            (-2)
#define BSP_UART_ERR                (-1)
#define BSP_UART_OK                 (0)

/* Exported types ------------------------------------------------------------*/
typedef void (*rx_completed_cb_function_t)(bsp_uart_id_t uart_id, uint16_t size);

/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions prototypes ---------------------------------------------*/

int32_t bsp_uart_ex_add_rx_completed_cb(bsp_uart_id_t uart_id, rx_completed_cb_function_t rx_irq_cb);

uint32_t bsp_uart_ex_get_timeout(uint32_t bps, int32_t len);

//#define bsp_uart_ex_tx(uart_id, buf, buflen, timeout_ms)    bsp_uart_dma_tx(uart_id, buf, buflen, timeout_ms)

//#define bsp_uart_ex_rx(uart_id, buf, buflen)                bsp_uart_dma_rx(uart_id, buf, buflen, TX_NO_WAIT)


/**
  * @}
  */

#ifdef __cplusplus
}
#endif

#endif /* __BSP_UART_EX_NEW_H */

/******************* (C)COPYRIGHT 2021 ***** END OF FILE *********************/
